package com.ylesb.ioc.shoucmd;
/**
 * @title: ShowCmdTest
 * @projectName springdemo
 * @description: TODO
 * @author White
 * @site : [www.ylesb.com]
 * @date 2022/7/713:27
 */

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @className    : ShowCmdTest
 * @description  : [描述说明该类的功能]  
 * @author       : [XuGuangchao]
 * @site         : [www.ylesb.com]
 * @version      : [v1.0]
 * @createTime   : [2022/7/7 13:27]
 * @updateUser   : [XuGuangchao]
 * @updateTime   : [2022/7/7 13:27]
 * @updateRemark : [描述说明本次修改内容] 
 */

public class ShowCmdTest {
    public static void main(String[] args) {
        //多环境切换
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
        ctx.getEnvironment().setActiveProfiles("prod");
        ctx.register(JavaConfig.class);
        ctx.refresh();
        DataSource ds = ctx.getBean(DataSource.class);
        System.out.println("ds = " + ds);

        //条件注解
        //AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(JavaConfig.class);
        //ShowCmd cmd = (ShowCmd)ctx.getBean("cmd");
        //String s= cmd.showCmd();
        //System.out.println("s = " +s);
    }
}
